//
//  TXHttpService.m
//  TXKit
//
//  Created by YM on 16/11/24.
//  Copyright © 2016年 Tincent. All rights reserved.
//

#import "TXHttpService.h"
#import "TXAFHttpManger.h"

@implementation TXHttpService

+(instancetype)shareInstance
{
    static dispatch_once_t onceToken;
    static TXHttpService* ret=nil;
    dispatch_once(&onceToken, ^{
        ret = [[TXHttpService alloc] init];
    });
    return ret;
}

-(id)requestWithUrl:(NSString*) url
            headers:(NSDictionary *) headers
             params:(NSDictionary *) params
             method:(HttpMethod ) method
         cacheBlock:(void (^)(NSDictionary *cacheObj))onCached
        finishBlock:(void (^)(NSDictionary *jsonObj, NSError *error)) onFinished
{

    return [TXAFHttpManger requestWithUrl:url headers:headers params:params method:method cacheBlock:onCached finishBlock:onFinished];
}

-(id)requestWithUrl:(NSString*) url
            headers:(NSDictionary *) headers
             params:(NSDictionary *) params
        isParamSign:(BOOL ) isParamSign
     isResponseJson:(BOOL ) isResponseJson
             method:(HttpMethod ) method
         cacheBlock:(void (^)(id cacheObj))onCached
        finishBlock:(void (^)(id responseObj, NSError *error)) onFinished
{
    
    return [TXAFHttpManger requestWithUrl:url headers:headers params:params isParamSign:isParamSign isResponseJson:isResponseJson method:method cacheBlock:onCached finishBlock:onFinished];
}

@end
